{include file='common/head.html'}
<style>
	html,body,.layui-body {
		height: 100%;
	}
	.layui-body {
		padding: 0;
	}
	/*相关字段 @mk-关联字段用*/
    xm-select > .xm-body {
        z-index: 9999!important;
    }
</style>
<script type="text/javascript" src="{APP_THEME_DIR}/js/jquery.dragsort-0.5.2.min.js"></script>
<script src="{APP_THEME_DIR}/js/xm-select.js"></script>
<div class="layui-body">
	{if([$list])}
	<div class="layui-tab layui-tab-brief content-wrap" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" lay-id="t1">内容列表</li>
	    <li lay-id="t2">发布内容</li>
		{if(check_level('addbatch'))}
	    <li lay-id="t3">批量上传</li>
		{/if}
	  </ul>
	  <div class="layui-tab-content">
	  	   <div class="layui-tab-item layui-show">
	  	   		<form action="{url./admin/Content/index/mcode/'.get('mcode').'}" method="get" class="layui-form">
		  	   		<div class="layui-form-item nospace">
						<div class="layui-input-inline" {if(!get('old'))}style="display:none;"{/if}>
							{$pathinfo}
					  		<select name="scode">
								<option value="">全部栏目</option>
						   		{$search_select}
					  		</select>
				   		</div>
	                     <div class="layui-input-inline">
	                     	<input type="text" name="keyword"  value="{$get.keyword}"  placeholder="请输入搜索关键字" class="layui-input">
	                     </div>
						 <div class="layui-input-inline w150">
							<select name="attribute">
								<option value="">选择属性</option>
								<option value="istop" {if(get('attribute')=='istop')}selected{/if}>置顶</option>
								<option value="isrecommend" {if(get('attribute')=='isrecommend')}selected{/if}>推荐</option>
								<option value="isheadline" {if(get('attribute')=='isheadline')}selected{/if}>头条</option>
							</select>
						</div>
						<div class="layui-input-inline w150">
							<select name="status">
								<option value="">状态不限</option>
								<option value="1" {if(get('status')=='1')}selected{/if}>已发布</option>
								<option value="0" {if(get('status')=='0')}selected{/if}>待发布</option>
							</select>
						</div>
	                     <div class="layui-input-inline" style="width: auto;">
	                     	<button class="layui-btn" lay-submit onclick="submit();">搜索</button>
							<a class="layui-btn layui-btn-primary"  href="{url./admin/Content/index/mcode/'.get('mcode'). '/scode/'.get('scode').'/old/'.get('old').'}">清除搜索</a>
	                     </div>
	                </div>
                </form>
                
	  	   		<form action="{url./admin/Content/mod}" method="post" id="contentForm" name="contentForm" class="layui-form content-list">
		            <input type="hidden" name="formcheck" value="{$formcheck}" > 
		            <table class="layui-table">
		            	<thead>
		                    <tr>
		                    	<th width="15"><input type="checkbox" class="checkbox" lay-ignore id="checkall" title="全选"></th>
								<th width="35">排序</th>
		                    	<th width="20">ID</th>
		                        <th class="left">标题</th>
								<th width="50">缩略图</th>
								<th width="120">栏目</th>
								<th width="30">人气</th>
								{if([$configs.is_member.value])}
		                        <th width="60">发布人</th>
								{/if}
		                        <th width="80">发布时间</th>
		                        <th width="30">推荐</th>
								<th width="30">状态</th>
		                        
		                        <th width="120">操作</th>
		                    </tr>
		                </thead>
		                <tbody>
		                    {foreach $contents(key,value)}
		                    <tr>
		                    	<td>
		                    		<input type="checkbox" class="checkbox checkitem" lay-ignore name="list[]" {if($value->outlink)}disabled{/if} value="[value->id]">
		                    		<input type="hidden" name="listall[]" value="[value->id]">
		                    	</td>
								<td class="table-input"><input type="text" lay-ignore class="layui-input" name="sorting[]" value="[value->sorting]"></td>
		                    	<td>[value->id]</td>
		                        <td class="left">
		                        [value->title]
		                        {if($value->isheadline)}
		                        	<span class="layui-badge layui-bg-blue">头</span>
		                        {/if}
		                        {if($value->ico)}
		                        	<span class="layui-badge layui-bg-orange">缩</span>
		                        {/if}
		                        {if($value->pics)}
		                        	<span class="layui-badge">图</span>
		                        {/if}
		                        {if($value->outlink)}
	                            	<span class="layui-badge layui-bg-black">链</span>
	                            {/if}
		                        </td>
								<td style="text-align: center;">
                                    <div class="tit-ico">
                                        {if($value->ico)}
                                        <img src="{php}$ico=$value->ico;get_thumb($ico,200,200);{/php}" height="40px">
										<img class="stimg" data-src="[value->ico]" width="200">
                                        {else}
                                        <img src="{APP_THEME_DIR}/images/nopic.png" height="40px">
                                        {/if}
                                    </div>
                                </td>
                                <td>[value->sortname]</td>
								<td>[value->visits]</td>
								{if([$configs.is_member.value])}
		                        <td>[value->create_user]{if($value->isfront)}<span style="color:#1E9FFF;margin-left:3px;" title="会员发布"><i class="fa fa-user-o" aria-hidden="true"></i><span>{/if}</td>
								{/if}
		                        <td>[value->date]</td>
			                    <td>
		                        {if($value->isrecommend)}
			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/isrecommend/value/0}"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
			                        {else}
			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/isrecommend/value/1}"><i class='fa fa-toggle-off' title="点击开启"></i></a>
			                    {/if}
			                    </td>
			                    
								<td>
		                        {if($value->status)}
			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/0}"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
			                        {else}
			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/1}"><i class='fa fa-toggle-off' title="点击开启"></i></a>
			                    {/if}
			                    </td>
		                        <td>
		                            {if(check_level('mod'))}
		                            	<a href="{url./admin/Content/mod/mcode/'.get('mcode').'/id/'.$value->id.'}{$btnqs}" class="layui-btn layui-btn-xs" >修改</a>
		                            {/if}
		                            {fun=get_btn_del($value->id)}
		                            {if(!$value->outlink)}
			                        	{php}
				                        	$sortfilename = $value->sortfilename;
				                        	$contentfilename = $value->filename;
				                        	$id = $value->id;
				                        	$urlname = $value->urlname?:'list';
				                        	$scode = $value->scode;
				                        	$url_break_char= get_var('url_break_char');
				                        	
				                        	if ($sortfilename && $contentfilename) {
							                    $link = homeurladmin('home/Index/' . $sortfilename . '/' . $contentfilename, true);
							                } elseif ($sortfilename) {
							                    $link = homeurladmin('home/Index/' . $sortfilename . '/' . $id, true);
							                } elseif ($contentfilename) {
							                    $link = homeurladmin('home/Index/' . $urlname . $url_break_char . $scode . '/' . $contentfilename, true);
							                } else {
							                    $link = homeurladmin('home/Index/' . $urlname . $url_break_char . $scode . '/' . $id, true);
							                }
			                        	{/php}
	
			                        	<input type="hidden" name="urls[[value->id]]" value="{php}echo $link{/php}">
			                        	<a href="{php}echo $link{/php}" class="layui-btn layui-btn-xs layui-btn-primary"  target="_blank">查看</a>
		                        	{/if}
		                        </td>
		                    </tr>
		                    {/foreach}
		                </tbody>
		            </table>
			       
			        
			        <div class="layui-inline layui-input-sm" style="float:right">
			     		<select lay-filter="tourl" class="page-select" >
							<option value="" selected="">每页显示数量</option>
							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/scode/'.get('scode').'/pagesize/20}" {if(get('pagesize')==20)}selected{/if}>20条/页</option>
							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/scode/'.get('scode').'/pagesize/30}" {if(get('pagesize')==30)}selected{/if}>30条/页</option>
							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/scode/'.get('scode').'/pagesize/50}" {if(get('pagesize')==50)}selected{/if}>50条/页</option>
							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/scode/'.get('scode').'/pagesize/60}" {if(get('pagesize')==60)}selected{/if}>60条/页</option>
							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/scode/'.get('scode').'/pagesize/100}" {if(get('pagesize')==100)}selected{/if}>100条/页</option>
							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/scode/'.get('scode').'/pagesize/150}" {if(get('pagesize')==150)}selected{/if}>150条/页</option>
							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/scode/'.get('scode').'/pagesize/200}" {if(get('pagesize')==200)}selected{/if}>200条/页</option>
						</select>
					</div>
						
			        <div class="layui-input-inline layui-input-sm select-cate">
				     	 <select name="scode">
	                        	<option value="">请选择移动/复制到栏目</option>
	                             {$search_select}
	                     </select>
                    </div>
                    
                    <div class="layui-btn-group">
	                    {if(check_level('mod'))}
	                    	<button type="submit" name="submit" value="copy" onclick="return setModAction();" class="layui-btn layui-btn-sm">复制</button>
	                    	<button type="submit" name="submit" value="move" onclick="return setModAction();" class="layui-btn layui-btn-sm">移动</button>
	                    {/if}
	                    
				     	{if(check_level('mod'))}
				     		<button type="submit" name="submit" value="sorting" onclick="return setModAction();" class="layui-btn layui-btn-sm">保存排序</button>
					     	{if([$baidu_zz_token])}
					     		<button type="submit" name="submit" value="baiduzz" onclick="return setModAction();" class="layui-btn layui-btn-sm">百度普通推送</button>
					     	{/if}
					     	{if([$baidu_ks_token])}
					     		<button type="submit" name="submit" value="baiduks" onclick="return setModAction();" class="layui-btn layui-btn-sm">百度快速推送</button>
					     	{/if}
				     	 {/if}

				     	 {if(check_level('del'))}
	                    	<button type="submit" name="submit" onclick="return setDelAction();" class="layui-btn layui-btn-sm layui-btn-danger">批量删除</button>
				     	{/if}
			     	 </div>
			     	<script>
			     		function setDelAction(){
			     		    document.contentForm.action = "{url./admin/Content/del}"; 
			     		    return confirm("您确定要删除选中的内容么？");
			     		}
			     		function setModAction(){
			     		    document.contentForm.action = "{url./admin/Content/mod}"; 
			     		}
						$(".tit-ico").hover(function(){
							$(this).find(".stimg").attr('src',$(this).find(".stimg").data("src"));
							$(this).find(".stimg").show();
						},function(){
							$(this).find(".stimg").hide();
						})
			     	</script>
			     	<div class="page">
			     		{$pagebar}
			     	</div>
			      </form> 
	  	   </div>
	  	   
	  	   <div class="layui-tab-item">
	  	  		<form action="{url./admin/Content/add/mcode/'.get('mcode').'}" method="post" class="layui-form" lay-filter="content" id="edit">
		  	     	<input type="hidden" name="formcheck" value="{$formcheck}" > 
		  	     	<div class="layui-tab mt0">
					  <ul class="layui-tab-title">
					    <li class="layui-this">基本内容</li>
					    <li>SEO内容</li>
					    <li>高级内容</li>
					  </ul>
					  <div class="layui-tab-content content-editor">
					    <div class="layui-tab-item layui-show">
					    	<div class="layui-form-item">
			                     <label class="layui-form-label">内容栏目   <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block cate-select">
			                     	<select name="scode" lay-verify="required">
				                        <option value="">请选择内容栏目</option>
			                        	{$sort_select}
				                    </select>
			                     </div>
			                </div>
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容标题   <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="title" required lay-verify="required" placeholder="" class="layui-input input-title">
			                     </div>
			                </div>

							{if([$field_titlecolor])}
							<div class="layui-form-item">
								<label class="layui-form-label">标题颜色</label>
								<div class="layui-input-inline">
									<input type="text" name="titlecolor" placeholder="请选择标题颜色" value="#333333" class="layui-input jscolor {hash:true}">
								</div>
							</div>
							{/if}

							{if([$field_subtitle])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">副标题</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="subtitle" placeholder="" class="layui-input">
			                     </div>
			                </div>
							{/if}

							{if([$field_enclosure])}
			                <div class="layui-form-item">
		                		<label class="layui-form-label">附件</label>
		                		<div class="layui-input-inline">
			                     	<input type="text" name="enclosure" id="enclosure" placeholder=""  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn layui-btn-primary file" data-des="enclosure">
								 	 <i class="layui-icon">&#xe67c;</i>上传附件
								 </button>
			                </div>
							{/if}
			                
			                 {foreach $extfield(key,value)}
			                	{if($value->type==1)} <!-- 单行文本 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                    	<input type="text" name="[value->name]"  placeholder=""  class="layui-input">
				                	</div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==2)}<!-- 多行文本 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                		<textarea name="[value->name]" class="layui-textarea" placeholder=""></textarea>
				                	</div>
				                </div>
			                	{/if}
			                	
			                    {if($value->type==3)}<!-- 单选 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                		<div>
				                			{php}
				                				$radios=explode(',',$value->value);
				                				foreach ($radios as $value2) {
	                								echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'">';
	            								}
	            						     {/php}
					                    </div>
				                	</div>
				                </div>
			                	{/if}
			                	
			                    {if($value->type==4)}<!-- 多选 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                		<div>
				                			{php}
				                				$checkboxs=explode(',',$value->value);
				                				foreach ($checkboxs as $value2) {
	            									echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'">';
	            								}
	            						     {/php}
					                    </div>
				                	</div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==5)}<!-- 图片 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-inline">
				                     	<input type="text" name="[value->name]" id="[value->name]" placeholder=""  class="layui-input">
				                     </div>
				                     <button type="button" class="layui-btn layui-btn-primary upload watermark" data-des="[value->name]">
									 	 <i class="layui-icon">&#xe67c;</i>上传图片
									 </button>
                                     <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'[value->name]');"><i class="layui-icon">&#xe64a;</i>图库</a>
									 <div id="[value->name]_box" class="pic"></div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==6)}<!-- 文件 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-inline">
				                     	<input type="text" name="[value->name]" id="[value->name]" placeholder=""  class="layui-input">
				                     </div>
				                     <button type="button" class="layui-btn layui-btn-primary file" data-des="[value->name]">
									 	 <i class="layui-icon">&#xe67c;</i>上传文件
									 </button>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==7)}<!-- 日期 -->
				                <div class="layui-form-item">
				                     <label class="layui-form-label">[value->description]</label>
				                     <div class="layui-input-block">
				                     	<input type="text" name="[value->name]" readonly placeholder=""  class="layui-input datetime">
				                     </div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==9)}<!-- 下拉 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
			                			<select name="[value->name]">
			                				{php}
				                				$selects=explode(',',$value->value);
				                				foreach ($selects as $value2) {
	                								echo '<option value="'.$value2.'">'.$value2.'</option>';
	            								}
	            						     {/php}
			                			</select>
				                	</div>
				                </div>
			                	{/if}

			                	{if($value->type==10)}
			                	<!-- 多图 -->
			                	<div class="layui-form-item">
			                	    <label class="layui-form-label">[value->description]</label>
			                	    <input type="hidden" name="[value->name]" id="pics_[value->name]" placeholder="" class="layui-input">
			                	    <button type="button" class="layui-btn uploads layui-btn-primary" data-des="pics_[value->name]">
			                	        <i class="layui-icon">&#xe67c;</i>上传多图
			                	    </button>
                                    <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(100,'pics_[value->name]');"><i class="layui-icon">&#xe64a;</i>图库</a>
			                	    <div id="pics_[value->name]_box" class="pic addedit add_pics">
			                	        <dl></dl> <!-- 规避空内容拖动bug -->
			                	    </div>
			                	    <script type="text/javascript">
			                	    $("#pics_[value->name]_box").dragsort({
			                	        dragSelector: "dl",
			                	        dragBetween: false,
			                	        dragSelectorExclude: "input,textarea,dd",
			                	        dragEnd: saveOrder_[value->name],
			                	        placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
			                	    });

			                	    function saveOrder_[value->name]() {
			                	        var data = $("#pics_[value->name]_box dl dt img").map(function() {
			                	            return $(this).data("url");
			                	        }).get();
			                	    };
			                	    </script>
			                	</div>
			                	{/if}

			                	{if($value->type==13)}
			                	<!-- 多图（带描述） -->
			                	<div class="layui-form-item">
			                	    <label class="layui-form-label">[value->description]</label>
			                	    <input type="hidden" name="[value->name]" id="pics_[value->name]" placeholder="" class="layui-input">
			                	    <button type="button" class="layui-btn uploads layui-btn-primary" data-des="pics_[value->name]">
			                	        <i class="layui-icon">&#xe67c;</i>上传多图
			                	    </button>
                                    <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(100,'pics_[value->name]');"><i class="layui-icon">&#xe64a;</i>图库</a>
			                	    <div id="pics_[value->name]_box" class="pic addedit add_pics add_pics_desc">
			                	        <dl></dl> <!-- 规避空内容拖动bug -->
			                	    </div>
			                	    <script type="text/javascript">
			                	    $("#pics_[value->name]_box").dragsort({
			                	        dragSelector: "dl",
			                	        dragBetween: false,
			                	        dragSelectorExclude: "input,textarea,dd",
			                	        dragEnd: saveOrder_[value->name],
			                	        placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
			                	    });

			                	    function saveOrder_[value->name]() {
			                	        var data = $("#pics_[value->name]_box dl dt img").map(function() {
			                	            return $(this).data("url");
			                	        }).get();
			                	    };
			                	    </script>
			                	</div>
			                	{/if}

			                	<!-- @mk-关联字段用 -->
			                	{if($value->type==11)}
                                <!-- 单选相关 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">[value->description]</label>
                                    <div class="layui-input-block">
                                        <div>
                                            {php}
                                            $related=explode(',',$value->value);
                                            $contents = get_list($related[0],$related[1]);
                                            $name=$value->name;
                                            echo '<input name="'.$value->name.'" type="hidden">';//占位清空
                                            $values=explode(',',$this->vars['content']->$name);
                                            foreach ($contents as $value2) {
                                            echo '<input type="radio" name="'.$value->name.'[]" value="'.$value2->id.'" title="'.$value2->title.'">';
                                            }
                                            {/php}
                                        </div>
                                    </div>
                                </div>
                                {/if}
                                
                                {if($value->type==12)}
                                <!-- 多选相关 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">[value->description]</label>
                                    <input type="hidden" name="[value->name]" id="[value->name]-value">
                                    <div class="layui-input-block">
                                        <div id="[value->name]" class="xm-select-demo"></div>
                                    </div>
                                    <script>
                                        var [value->name] = xmSelect.render({
    			                	        el: '#[value->name]',
    			                	        language: 'zn',
    			                	        filterable: true,
    			                	        on: function(data){
    			                	            var arr = data.arr;
    			                	            var str='';
    			                	            for(j = 0,len=arr.length; j < len; j++) {
    			                	               str+=arr[j]['value']+','
    			                	            }
    			                	            $("#[value->name]-value").val(str);
    			                	        },
    			                	        data: [
    			                	            {php}
    			                	            $related=explode(',',$value->value);
    			                	            $contents = get_list($related[0],$related[1]);
    			                	            $name=$value->name;
    			                	            $values=explode(',',$this->vars['content']->$name);
    			                	            foreach ($contents as $value2) {
    			                	            echo '{name: "'.$value2->title.'", value: "'.$value2->id.'"},';
    			                	            }
    			                	            {/php}
    			                	        ]
    			                	    })
    			                	</script>
                                </div>
                                {/if}
			                	
			                {/foreach}

							{if([$configs.editortab.value])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容详情</label>
			                     <div class="layui-input-block">
									<div class="layui-tab" style="margin: 0;">
										<ul class="layui-tab-title layui-tab-title-content">
											<li class="layui-this">默认内容</li>
											{foreach $extfield(key,value)}
											{if($value->type==8)}
											<li>[value->description]</li>
											{/if}
											{/foreach}
										</ul>
										<div class="layui-tab-content" style="padding: 0;margin-top:-1px;">
											<div class="layui-tab-item layui-show">
												<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;">{fun=decode_string([$content->content])}</script>
											</div>
											{foreach $extfield(key,value)}
											{if($value->type==8)}
											<div class="layui-tab-item">
												<script type="text/plain" id="editor_[value->name]" name="[value->name]" style="width:100%;height:240px;"></script>
												<script>
													//初始化编辑器
													$(document).ready(function (e) {
														var ue = UE.getEditor('editor_[value->name]', {
															maximumWords: 10000
														});
													})
												</script>
											</div>
											{/if}
											{/foreach}
										</div>
									</div>
			                     </div>
			                </div>
							{else}
							<div class="layui-form-item">
			                     <label class="layui-form-label">内容详情</label>
			                     <div class="layui-input-block">
			                     	<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;"></script>
			                     </div>
			                </div>
							{foreach $extfield(key,value)}
							{if($value->type==8)}
							<div class="layui-form-item">
								<label class="layui-form-label">[value->description]</label>
								<div class="layui-input-block">
									<script type="text/plain" id="editor_[value->name]" name="[value->name]" style="width:100%;height:240px;"></script>
									<script>
										//初始化编辑器
										$(document).ready(function (e) {
											var ue = UE.getEditor('editor_[value->name]',{
												maximumWords:10000 
											});
										})
									</script>
								</div>
							</div>
							{/if}
							{/foreach}
							{/if}

			                <div class="layui-form-item">
			                     <label class="layui-form-label">缩略图</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="ico" id="ico" placeholder=""  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn layui-btn-primary upload watermark" data-des="ico">
								 	 <i class="layui-icon">&#xe67c;</i>上传图片
								 </button>
                                 <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'ico');"><i class="layui-icon">&#xe64a;</i>图库</a>
								 <div id="ico_box" class="pic addedit"></div>
			                </div>
							{if([$field_pics])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">轮播多图</label>
								 <input type="hidden" name="pics" id="pics" placeholder="上传多图"  class="layui-input">
			                     <button type="button" class="layui-btn uploads layui-btn-primary watermark" data-des="pics">
								 	 <i class="layui-icon">&#xe67c;</i>上传多图
								 </button>
                                 <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(100,'pics');"><i class="layui-icon">&#xe64a;</i>图库</a>
								 <div id="pics_box" class="pic addedit add_pics"><dl></dl> <!-- 规避空内容拖动bug --></div>
			                </div>
							{/if}
			                
			                
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">参数</label>
			                     <div class="layui-input-block">
									<input type="checkbox" name="istop" value="1" title="置顶">
			                    	<input type="checkbox" name="isrecommend" value="1" title="推荐">
			                    	<input type="checkbox" name="isheadline" value="1" title="头条">
			                     </div>
			                </div>
			                {if([$configs.is_member.value])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">浏览权限</label>
			                     <div class="layui-input-block">
									<select name="gid">
										<option value="">不限制</option>
				                        {foreach $groups(key,value)}
				                            <option value="[value->id]">[value->gname]</option>
				                        {/foreach}
				                    </select>
			                     </div>
			                </div>  
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">权限类型</label>
			                     <div class="layui-input-block">
			                     	<select name="gtype" id="gtype" >
			                     		<option value="1">小于</option>
			                     		<option value="2">小于等于</option>
			                     		<option value="3">等于</option>
			                     		<option value="4" selected>大于等于</option>
			                     		<option value="5">大于</option>
									</select>
			                     </div>
			                </div>  
							<div class="layui-form-item">
			                     <label class="layui-form-label">权限不足提示</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="gnote" placeholder="请输入权限不足时提示文本"  class="layui-input">
			                     </div>
			                </div>
			                {/if}
					    </div>
					    <div class="layui-tab-item">
							{if([$field_seotitle])}
							<div class="layui-form-item">
					    	     <label class="layui-form-label">SEO标题</label>
					    	     <div class="layui-input-block">
					    	     	<input type="text" name="seotitle" placeholder="填写后内容页title将显示：seo标题-站点标题" class="layui-input">
					    	     </div>
					    	</div>
							{/if}
					    	<div class="layui-form-item">
					    	     <label class="layui-form-label">SEO关键词</label>
					    	     <div class="layui-input-block">
					    	     	<input type="text" name="keywords" placeholder="每个SEO关键词之间用英文逗号隔开" class="layui-input">
					    	     </div>
					    	</div>
					    	
					    	<div class="layui-form-item">
					    	     <label class="layui-form-label">SEO描述</label>
					    	     <div class="layui-input-block">
					    	     	<textarea name="description" placeholder="如未填写则自动提取文章前200字符生成SEO描述" class="layui-textarea"></textarea>
					    	     </div>
					    	</div>
							{if([$field_tags])}
							<div class="layui-form-item">
			                     <label class="layui-form-label">TAG标签</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="tags" placeholder="每个TAG标签之间用英文逗号隔开" class="layui-input">
			                     </div>
			                </div>
							{/if}
							{if([$field_filename])}
							<div class="layui-form-item">
			                     <label class="layui-form-label">URL名称</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="filename" placeholder="可自定义详情页URL名称，例如从/news/1.html变成/news/test-article.html" class="layui-input">
			                     </div>
			                 </div>
							 {/if}
					    </div>
					    <div class="layui-tab-item ">
					    	

							{if([$field_subscode])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容副栏目</label>
			                     <div class="layui-input-block">
			                     	<select name="subscode">
				                        <option value="">请选择内容副栏目</option>
			                        	{$subsort_select}
				                    </select>
			                     </div>
			                </div>
							{/if}
			                
							<input type="hidden" name="titlecolor" placeholder="" value="#333333" class="layui-input jscolor {hash:true}">
			                 
			                  <div class="layui-form-item">
			                     <label class="layui-form-label">跳转外链接</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="outlink" placeholder="" class="layui-input">
			                     </div>
			                 </div>

			                <div class="layui-form-item">
								<label class="layui-form-label">内容页模板</label>
								<div class="layui-input-inline">
									<select name="tpl" id="tpl" >
										<option value="">无</option>
										{foreach $tpls(key,value)}
										<option value="[value]">[value]</option>
									   	{/foreach}
									</select>
								</div>
								<div class="layui-form-mid layui-word-aux">温馨提示：为空（无）即默认模板</div>
						   	</div>

							<div class="layui-form-item">
			                     <label class="layui-form-label">作者昵称</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="author" placeholder="" value="{$session.realname}" class="layui-input">
			                     </div>
			                </div>
			                
			                
							{if([$field_source])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">来源</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="source" placeholder="" value="本站" class="layui-input">
			                     </div>
			                </div>
							{/if}

							<div class="layui-form-item">
						   	    <label class="layui-form-label">浏览量</label>
						   	    <div class="layui-input-inline">
						   	        <input type="text" name="visits" placeholder="" value="0" class="layui-input">
						   	    </div>
								<div class="layui-form-mid layui-word-aux">温馨提示：支持自定义浏览量</div>
						   	</div>

							<div class="layui-form-item">
			                     <label class="layui-form-label">发布时间</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="date" value="{fun=date('Y-m-d H:i:s')}" readonly placeholder=""  class="layui-input datetime">
			                     </div>
			                     <div class="layui-form-mid layui-word-aux">温馨提示：设置未来时间可定时发布！</div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">状态</label>
			                     <div class="layui-input-block">
			                     	<input type="radio" name="status" value="1" title="显示" checked>
									<input type="radio" name="status" value="0" title="待审核">
			                     </div>
			                </div>
					    </div>
					  </div>
					</div>
					<div class="layui-form-item">
						 <div class="layui-input-block">
						    <button type="button" class="layui-btn" lay-submit lay-filter="*" onclick="subclick()">立即提交</button>
						 </div>
					</div>
			   </form>
	  	   </div>
			{if(check_level('addbatch'))}		
	  	    <div class="layui-tab-item">
	  	       <form action="{url./admin/Content/addbatch/mcode/'.get('mcode').'}" method="post" class="layui-form js-edit-form" lay-filter="content">
	  	           <input type="hidden" name="formcheck" value="{$formcheck}">
	  	           <div class="layui-tab mt0">
	  	              
	  	               <div class="layui-tab-content" style="padding: 0;">
	  	                   <div class="layui-tab-item layui-show">
	  	                       <div class="layui-form-item">
	  	                           <label class="layui-form-label">操作提示：</label>
	  	                           <div class="layui-input-block">
	  	                               <blockquote class="layui-elem-quote">批量上传图片发布后，系统会自动生成以图片名称为标题、图片为缩略图的的内容。（适合公司实力展示类图片上传使用，例如荣誉证书、设备展示等）</blockquote>
	  	                           </div>
	  	                       </div>
	  	                       
	  	                       <div class="layui-form-item">
	  	                           <label class="layui-form-label">所属栏目 <span class="layui-text-red">*</span></label>
	  	                           <div class="layui-input-block">
	  	                               <select name="scode" lay-verify="required">
	  	                                   <option value="">请选择所属栏目</option>
	  	                                   {$sort_select}
	  	                               </select>
	  	                           </div>
	  	                       </div>
	  	                       <div class="layui-form-item">
	  	                           <label class="layui-form-label">批量上传 <span class="layui-text-red">*</span></label>
	  	                           <div class="layui-input-inline">
	  	                               <input type="hidden" name="pics_batch" id="pics_batch" placeholder="" class="layui-input" lay-verify="required">
	  	                           </div>
	  	                           <button type="button" class="layui-btn uploads layui-btn-primary watermark" data-des="pics_batch">
	  	                               <i class="layui-icon">&#xe67c;</i>上传多图
	  	                           </button>
                                   <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(100,'pics_batch');"><i class="layui-icon">&#xe64a;</i>图库</a>
	  	                           <div id="pics_batch_box" class="pic addedit add_pics">
	  	                               <dl style="border: none;margin-top: 0;"></dl> <!-- 规避空内容拖动bug -->
	  	                           </div>
	  	                           <script type="text/javascript">
	  	                           $("#pics_batch_box").dragsort({
	  	                                       dragSelector: "dl",
	  	                                       dragBetween: false,
	  	                                       dragSelectorExclude: "input,textarea,dd",
	  	                                       dragEnd: saveOrder_pics_batch,
	  	                                           placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
	  	                                       });

	  	                                   function saveOrder_pics_batch() {
	  	                                       var data = $("#pics_batch_box dl dt img").map(function() {
	  	                                           return $(this).data("url");
	  	                                       }).get();
	  	                                   };
	  	                           </script>
	  	                       </div>

								<input type="hidden" name="tags">
								<input type="hidden" name="author" value="{$session.realname}">
								<input type="hidden" name="source" value="本站">
								<input type="hidden" name="visits" value="0">

	  	                        <div class="layui-form-item">
	  	                            <label class="layui-form-label">发布时间</label>
	  	                            <div class="layui-input-inline">
	  	                            	<input type="text" name="date" value="{fun=date('Y-m-d H:i:s')}" readonly placeholder=""  class="layui-input datetime">
	  	                            </div>
	  	                            <div class="layui-form-mid layui-word-aux">温馨提示：设置未来时间可定时发布！</div>
	  	                       </div>

	  	                       <div class="layui-form-item">
	  	                           <label class="layui-form-label">状态</label>
	  	                           <div class="layui-input-block">
	  	                               <input type="radio" name="status" value="1" title="显示" checked>
	  	                               <input type="radio" name="status" value="0" title="隐藏">
	  	                           </div>
	  	                       </div>
	  	                       <input type="hidden" name="titlecolor" placeholder="" value="#333333" class="layui-input jscolor {hash:true}">
	  	                   </div>
	  	               </div>
	  	           </div>
	  	           <div class="layui-form-item">
	  	               <div class="layui-input-block">
	  	                   <button type="submit" class="layui-btn" lay-submit>立即提交</button>
	  	               </div>
	  	           </div>
	  	       </form>
	  	    </div>
			{/if}
	  </div>
	 </div>
	{/if} 
	
	{if([$mod])}
	
	<div class="layui-tab layui-tab-brief content-wrap" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this">内容修改</li>
	  </ul>
	  <div class="layui-tab-content">
	  	<div class="layui-tab-item layui-show">
	  		<form action="{url./admin/Content/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form" id="edit">
	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
	  			<div class="layui-tab mt0">
					  <ul class="layui-tab-title">
					    <li class="layui-this">基本内容</li>
					    <li>SEO内容</li>
					    <li>高级内容</li>
					  </ul>
					  <div class="layui-tab-content content-editor">
					    <div class="layui-tab-item layui-show">
					    	<div class="layui-form-item">
			                     <label class="layui-form-label">内容栏目   <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block cate-select">
			                     	<select name="scode" lay-verify="required">
				                        <option value="">请选择内容栏目</option>
			                        	{$sort_select}
				                    </select>
			                     </div>
			                </div>
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容标题   <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="title" required lay-verify="required" value="{$content->title}" placeholder="" class="layui-input input-title">
			                     </div>
			                </div>

							{if([$field_titlecolor])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">标题颜色</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="titlecolor" value="{$content->titlecolor}" placeholder="请选择标题颜色"  class="layui-input jscolor {hash:true}">
			                     </div>
			                 </div>
							{/if}

							{if([$field_subtitle])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">副标题</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="subtitle" value="{$content->subtitle}" placeholder="" class="layui-input">
			                     </div>
			                 </div>
							{/if}

							{if([$field_enclosure])}
			                <div class="layui-form-item">
		                		<label class="layui-form-label">附件</label>
		                		<div class="layui-input-inline">
			                     	<input type="text" name="enclosure" id="enclosure" value="{$content->enclosure}" placeholder=""  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn layui-btn-primary file" data-des="enclosure">
								 	 <i class="layui-icon">&#xe67c;</i>上传附件
								 </button>
			                </div>
							{/if}
			                
			                 {foreach $extfield(key,value)}
			                	{if($value->type==1)} <!-- 单行文本 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                    	<input type="text" name="[value->name]" value="{$content->{$value->name}}"  placeholder=""  class="layui-input">
				                	</div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==2)}<!-- 多行文本 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                		<textarea name="[value->name]" class="layui-textarea" placeholder="">{php}$name=$value->name;echo str_replace('<br>', "\r\n",$this->vars['content']->$name);{/php}</textarea>
				                	</div>
				                </div>
			                	{/if}
			                	
			                    {if($value->type==3)}<!-- 单选 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                		<div>
	            						     {php}
				                				$radios=explode(',',$value->value);
				                				$name=$value->name;
				                				foreach ($radios as $value2) {
				                					if($this->vars['content']->$name==$value2){
	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'" checked>';
	                								}else{
	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'">';
	                								}
	            								}
	            						     {/php}
					                    </div>
				                	</div>
				                </div>
			                	{/if}
			                	
			                    {if($value->type==4)}<!-- 多选 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
				                		<div>
				                			
	            						     {php}
				                				$checkboxs=explode(',',$value->value);
				                				$name=$value->name;
				                				echo '<input name="'.$value->name.'" type="hidden">';//占位清空
				                				$values=explode(',',$this->vars['content']->$name);
				                				foreach ($checkboxs as $value2) {
				                					if(in_array($value2,$values)){
	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'" checked>';
	            									}else{
	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'">';
	            									}
	            								}
	            						     {/php}
					                    </div>
				                	</div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==5)}<!-- 图片 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-inline">
				                     	<input type="text" name="[value->name]" id="[value->name]" value="{$content->{$value->name}}" placeholder=""  class="layui-input">
				                     </div>
				                     <button type="button" class="layui-btn layui-btn-primary upload watermark" data-des="[value->name]">
									 	 <i class="layui-icon">&#xe67c;</i>上传图片
									 </button>
                                     <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'[value->name]');"><i class="layui-icon">&#xe64a;</i>图库</a>
									 {php}$name=$value->name; {/php}
									 <div id="[value->name]_box" class="pic">{if([$content]->$name)}<dl><dt><img src='{SITE_DIR}{$content->{$value->name}}' data-url="{$content->{$value->name}}"></dt><dd>删除</dd></dl>{/if}</div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==6)}<!-- 文件 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-inline">
				                     	<input type="text" name="[value->name]" id="[value->name]" value="{$content->{$value->name}}" placeholder=""  class="layui-input">
				                     </div>
				                     <button type="button" class="layui-btn layui-btn-primary file" data-des="[value->name]">
									 	 <i class="layui-icon">&#xe67c;</i>上传文件
									 </button>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==7)}<!-- 日期 -->
				                <div class="layui-form-item">
				                     <label class="layui-form-label">[value->description]</label>
				                     <div class="layui-input-block">
				                     	<input type="text" name="[value->name]" value="{$content->{$value->name}}" readonly placeholder=""  class="layui-input datetime">
				                     </div>
				                </div>
			                	{/if}
			                	
			                	{if($value->type==9)}<!-- 下拉 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label">[value->description]</label>
			                		<div class="layui-input-block">
			                			<select name="[value->name]">
			                				{php}
				                				$selects=explode(',',$value->value);
				                				$name=$value->name;
				                				foreach ($selects as $value2) {
				                					if($this->vars['content']->$name==$value2){
				                						echo '<option value="'.$value2.'" selected>'.$value2.'</option>';
	                								}else{
	                									echo '<option value="'.$value2.'">'.$value2.'</option>';
	                								}
	            								}
	            						    {/php}
			                			</select>
				                	</div>
				                </div>
			                	{/if}

			                	{if($value->type==10)}
			                	<!-- 多图 -->
			                	<div class="layui-form-item">
			                	    <label class="layui-form-label">[value->description]</label>
			                	    <input type="hidden" name="[value->name]" id="pics_[value->name]" placeholder="" class="layui-input">
			                	    <button type="button" class="layui-btn uploads layui-btn-primary" data-des="pics_[value->name]">
			                	        <i class="layui-icon">&#xe67c;</i>上传多图
			                	    </button>
                                    <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(100,'pics_[value->name]');"><i class="layui-icon">&#xe64a;</i>图库</a>
			                	    <div id="pics_[value->name]_box" class="pic addedit add_pics">
			                	        <dl></dl> <!-- 规避空内容拖动bug -->
			                	        {php}$name=$value->name; {/php}
			                	        {php}
			                	        if([$content]->$name){
			                	        $pics=unserialize([$content]->$name);
			                	        }else{
			                	        $pics = array();
			                	        }
			                	        foreach ($pics as $key=>$value) {
			                	        echo "<dl><dt><img src='".SITE_DIR.$value[src]."' data-url='".$value[src]."' data-alt='".$value[alt]."'></dt>
			                	            <p><input type='text' class='form-control input-sm' placeholder='图片地址' name='img_pics_".$name."_src[]' value='".$value[src]."' size='30' style='color:#999;'></p>
			                	            <p><input type='text' class='form-control input-sm' placeholder='图片注释' name='img_pics_".$name."_alt[]' value='".$value[alt]."' size='30'></p>
			                	            <p style='display:none;'><textarea class='form-control input-sm' placeholder='图片描述' name='img_pics_".$name."_desc[]'>".$value[desc]."</textarea></p>
			                	            <dd>删除</dd>
			                	        </dl>";
			                	        }
			                	        {/php}
			                	    </div>
			                	    <script type="text/javascript">
			                	    $("#pics_{php}echo $name;{/php}_box").dragsort({
			                	                dragSelector: "dl",
			                	                dragBetween: false,
			                	                dragSelectorExclude: "input,textarea,dd",
			                	                dragEnd: saveOrder_{php}echo $name;{/php},
			                	                    placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
			                	                });

			                	            function saveOrder_{php}echo $name;{/php}() {
			                	                var data = $("#pics_{php}echo $name;{/php}_box dl dt img").map(function() {
			                	                    return $(this).data("url");
			                	                }).get();
			                	            };
			                	    </script>
			                	</div>
			                	{/if}

			                	{if($value->type==13)}
			                	<!-- 多图（带描述） -->
			                	<div class="layui-form-item">
			                	    <label class="layui-form-label">[value->description]</label>
			                	    <input type="hidden" name="[value->name]" id="pics_[value->name]" placeholder="" class="layui-input">
			                	    <button type="button" class="layui-btn uploads layui-btn-primary" data-des="pics_[value->name]">
			                	        <i class="layui-icon">&#xe67c;</i>上传多图
			                	    </button>
                                    <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(100,'pics_[value->name]');"><i class="layui-icon">&#xe64a;</i>图库</a>
			                	    <div id="pics_[value->name]_box" class="pic addedit add_pics add_pics_desc">
			                	        <dl></dl> <!-- 规避空内容拖动bug -->
			                	        {php}$name=$value->name; {/php}
			                	        {php}
			                	        if([$content]->$name){
			                	        $pics=unserialize([$content]->$name);
			                	        }else{
			                	        $pics = array();
			                	        }
			                	        foreach ($pics as $key=>$value) {
			                	        echo "<dl><dt><img src='".SITE_DIR.$value[src]."' data-url='".$value[src]."' data-alt='".$value[alt]."'></dt>
			                	            <p><input type='text' class='form-control input-sm' placeholder='图片地址' name='img_pics_".$name."_src[]' value='".$value[src]."' size='30' style='color:#999;'></p>
			                	            <p><input type='text' class='form-control input-sm' placeholder='图片注释' name='img_pics_".$name."_alt[]' value='".$value[alt]."' size='30'></p>
			                	            <p><textarea class='form-control input-sm' placeholder='图片描述' name='img_pics_".$name."_desc[]'>".$value[desc]."</textarea></p>
			                	            <dd>删除</dd>
			                	        </dl>";
			                	        }
			                	        {/php}
			                	    </div>
			                	    <script type="text/javascript">
			                	    $("#pics_{php}echo $name;{/php}_box").dragsort({
			                	                dragSelector: "dl",
			                	                dragBetween: false,
			                	                dragSelectorExclude: "input,textarea,dd",
			                	                dragEnd: saveOrder_{php}echo $name;{/php},
			                	                    placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
			                	                });

			                	            function saveOrder_{php}echo $name;{/php}() {
			                	                var data = $("#pics_{php}echo $name;{/php}_box dl dt img").map(function() {
			                	                    return $(this).data("url");
			                	                }).get();
			                	            };
			                	    </script>
			                	</div>
			                	{/if}

			                	<!-- @mk-关联字段用 -->
			                	{if($value->type==11)}
                                <!-- 单选相关 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">[value->description]</label>
                                    <div class="layui-input-block">
                                        <div>
                                            {php}
                                            $related=explode(',',$value->value);
                                            $contents = get_list($related[0],$related[1]);
                                            $name=$value->name;
                                            echo '<input name="'.$value->name.'" type="hidden">';//占位清空
                                            $values=explode(',',$this->vars['content']->$name);
                                            foreach ($contents as $value2) {
                                            if(in_array($value2->id,$values)){
                                            echo '<input type="radio" name="'.$value->name.'[]" value="'.$value2->id.'" title="'.$value2->title.'" checked>';
                                            }else{
                                            echo '<input type="radio" name="'.$value->name.'[]" value="'.$value2->id.'" title="'.$value2->title.'">';
                                            }
                                            }
                                            {/php}
                                        </div>
                                    </div>
                                </div>
                                {/if}
                                {if($value->type==12)}
                                <!-- 多选相关 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">[value->description]</label>
                                    <input type="hidden" name="[value->name]" id="[value->name]-value" value="{$content->{$value->name}}">
                                    <div class="layui-input-block">
                                        <div id="[value->name]" class="xm-select-demo"></div>
                                    </div>
                                    <script>
                                        var [value->name] = xmSelect.render({
    			                	        el: '#[value->name]',
    			                	        language: 'zn',
    			                	        filterable: true,
    			                	        on: function(data){
    			                	            var arr = data.arr;
    			                	            var str='';
    			                	            for(j = 0,len=arr.length; j < len; j++) {
    			                	               str+=arr[j]['value']+','
    			                	            }
    			                	            $("#[value->name]-value").val(str);
    			                	        },
    			                	        initValue: [
    			                	            {php}
    			                	            $name2=$value->name;
    			                	            echo $this->vars['content']->$name2;
    			                	            {/php}
    			                	        ],
    			                	        data: [
    			                	            {php}
    			                	            $related=explode(',',$value->value);
    			                	            $contents = get_list($related[0],$related[1]);
    			                	            $name=$value->name;
    			                	            $values=explode(',',$this->vars['content']->$name);
    			                	            foreach ($contents as $value2) {
    			                	            echo '{name: "'.$value2->title.'", value: "'.$value2->id.'"},';
    			                	            }
    			                	            {/php}
    			                	        ]
    			                	    })
    			                	</script>
                                </div>
                                {/if}
			                	
			                {/foreach}

							{if([$configs.editortab.value])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容详情</label>
			                     <div class="layui-input-block">
									<div class="layui-tab" style="margin: 0;">
										<ul class="layui-tab-title layui-tab-title-content">
											<li class="layui-this">默认内容</li>
											{foreach $extfield(key,value)}
											{if($value->type==8)}
											<li>[value->description]</li>
											{/if}
											{/foreach}
										</ul>
										<div class="layui-tab-content" style="padding: 0;margin-top:-1px;">
											<div class="layui-tab-item layui-show">
												<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;">{fun=decode_string([$content->content])}</script>
											</div>
											{foreach $extfield(key,value)}
											{if($value->type==8)}
											<div class="layui-tab-item">
												{php}$name=@$value->name;{/php}
												<script type="text/plain" id="editor_[value->name]" name="[value->name]" style="width:100%;height:240px;">{fun=decode_string([$content->$name])}</script>
												<script>
													//初始化编辑器
													$(document).ready(function (e) {
														var ue = UE.getEditor('editor_[value->name]',{
															maximumWords:10000 
														});
													})
												</script>
											</div>
											{/if}
											{/foreach}
										</div>
									</div>
			                     </div>
			                </div>
							{else}
							<div class="layui-form-item">
			                     <label class="layui-form-label">内容详情</label>
			                     <div class="layui-input-block">
			                     	<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;">{fun=decode_string([$content->content])}</script>
			                     </div>
			                </div>
							{foreach $extfield(key,value)}
								{if($value->type==8)}<!-- 编辑器 -->
								<div class="layui-form-item">
									<label class="layui-form-label">[value->description]</label>
									<div class="layui-input-block">
										{php}
											$name=@$value->name;
										{/php}
										<script type="text/plain" id="editor_[value->name]" name="[value->name]" style="width:100%;height:240px;">{fun=decode_string([$content->$name])}</script>
										<script>
											//初始化编辑器
											$(document).ready(function (e) {
												var ue = UE.getEditor('editor_[value->name]',{
													maximumWords:10000 
												});
											})
										</script>
									</div>
								</div>
								{/if}
							{/foreach}
							{/if}
			    
			                <div class="layui-form-item">
			                     <label class="layui-form-label">缩略图</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="ico" id="ico" value="{$content->ico}" placeholder=""  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn layui-btn-primary upload watermark" data-des="ico">
								 	 <i class="layui-icon">&#xe67c;</i>上传图片
								 </button>
                                 <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'ico');"><i class="layui-icon">&#xe64a;</i>图库</a>
								 <div id="ico_box" class="pic addedit">{if([$content->ico])}<dl><dt><img src="{SITE_DIR}{$content->ico}" data-url="{$content->ico}"></dt><dd>删除</dd></dl>{/if}</div>
			                </div>

							{if([$field_pics])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">轮播多图</label>
			                     <input type="hidden" name="pics" id="pics" placeholder="" class="layui-input">
			                     <button type="button" class="layui-btn uploads layui-btn-primary watermark" data-des="pics">
								 	 <i class="layui-icon">&#xe67c;</i>上传多图
								 </button>
                                 <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(100,'pics');"><i class="layui-icon">&#xe64a;</i>图库</a>
								 <div id="pics_box" class="pic addedit add_pics">
								     <dl></dl> <!-- 规避空内容拖动bug -->
								     {php}
								     if([$content->pics]){
								     $pics=unserialize([$content->pics]);
								     }else{
								     $pics = array();
								     }
								     foreach ($pics as $key=>$value) {
								     echo "<dl><dt><img src='".SITE_DIR.$value[src]."' data-url='".$value[src]."' data-alt='".$value[alt]."'></dt>
								         <p><input type='text' class='form-control input-sm' placeholder='图片地址' name='img_pics_src[]' value='".$value[src]."' size='30'></p>
								         <p><input type='text' class='form-control input-sm' placeholder='图片注释' name='img_pics_alt[]' value='".$value[alt]."' size='30'></p>
								         <dd>删除</dd>
								     </dl>";
								     }
								     {/php}
								 </div>
			                </div>
							{/if}
			                
			                
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">参数</label>
			                     <div class="layui-input-block">
									<input type="checkbox" name="istop" value="1" title="置顶" {if([$content->istop]==1)}checked{/if}>
			                    	<input type="checkbox" name="isrecommend" value="1" title="推荐" {if([$content->isrecommend]==1)}checked{/if}>
			                    	<input type="checkbox" name="isheadline" value="1" title="头条" {if([$content->isheadline]==1)}checked{/if}>
			                     </div>
			                </div>
			                {if([$configs.is_member.value])}
			                 <div class="layui-form-item">
			                     <label class="layui-form-label">浏览权限</label>
			                     <div class="layui-input-block">
									<select name="gid">
										<option value="">不限制</option>
				                        {foreach $groups(key,value)}
				                            <option value="[value->id]" {if([$content->gid]==$value->id)}selected="selected"{/if}>[value->gname]</option>
				                        {/foreach}
				                    </select>
			                     </div>
			                </div>  
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">权限类型</label>
			                     <div class="layui-input-block">
			                     	<select name="gtype" id="gtype" >
			                     		<option value="1" {if([$content->gtype]==1)}selected="selected"{/if}>小于</option>
			                     		<option value="2" {if([$content->gtype]==2)}selected="selected"{/if}>小于等于</option>
			                     		<option value="3" {if([$content->gtype]==3)}selected="selected"{/if}>等于</option>
			                     		<option value="4" {if([$content->gtype]==4||(![$sort->gtype]))}selected="selected"{/if}>大于等于</option>
			                     		<option value="5" {if([$content->gtype]==5)}selected="selected"{/if}>大于</option>
									</select>
			                     </div>
			                </div> 

							<div class="layui-form-item">
			                     <label class="layui-form-label">权限不足提示</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="gnote" value="{$content->gnote}"  placeholder="请输入权限不足时提示文本"  class="layui-input">
			                     </div>
			                </div>
			                {/if}
			                
					    </div>
					    <div class="layui-tab-item">
							{if([$field_seotitle])}
							<div class="layui-form-item">
			                     <label class="layui-form-label">SEO标题</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="seotitle" value="{$content->seotitle}"  placeholder="填写后内容页title将显示：seo标题-站点标题" class="layui-input">
			                     </div>
			                </div>
							{/if}
					    	
					    	<div class="layui-form-item">
			                     <label class="layui-form-label">SEO关键词</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="keywords" value="{$content->keywords}"  placeholder="每个SEO关键词之间用英文逗号隔开" class="layui-input">
			                     </div>
			                </div>
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">SEO描述</label>
			                     <div class="layui-input-block">
			                     	<textarea name="description" placeholder="如未填写则自动提取文章前200字符生成SEO描述" class="layui-textarea">{$content->description}</textarea>
			                     </div>
			                </div>
							{if([$field_tags])}
							<div class="layui-form-item">
					    	     <label class="layui-form-label">TAG标签</label>
					    	     <div class="layui-input-block">
					    	     	<input type="text" name="tags" placeholder="每个TAG标签之间用英文逗号隔开" value="{$content->tags}" class="layui-input">
					    	     </div>
					    	</div>
							{/if}
							{if([$field_filename])}
							<div class="layui-form-item">
			                     <label class="layui-form-label">URL名称</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="filename" value="{$content->filename}" placeholder="可自定义详情页URL名称，例如从/news/1.html变成/news/test-article.html" class="layui-input">
			                     </div>
			                 </div>
							 {/if}
					    </div>
					    <div class="layui-tab-item ">
							{if([$field_subscode])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容副栏目</label>
			                     <div class="layui-input-block">
			                     	<select name="subscode">
				                        <option value="">请选择内容副栏目</option>
			                        	{$subsort_select}
				                    </select>
			                     </div>
			                </div>
							{/if}
			                
							<input type="hidden" name="titlecolor" value="{$content->titlecolor}" placeholder=""  class="layui-input jscolor {hash:true}">
			
			                  <div class="layui-form-item">
			                     <label class="layui-form-label">跳转外链接</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="outlink" value="{$content->outlink}" placeholder="" class="layui-input">
			                     </div>
			                 </div>

		                	<div class="layui-form-item">
		                		<label class="layui-form-label">内容页模板</label>
		                		<div class="layui-input-inline">
		                			<select name="tpl" id="tpl" >
		                				<option value="{$content->tpl}">{$content->tpl}</option>
		                				<option value="">无</option>
		                				{foreach $tpls(key,value)}
		                					{if($value!=[$content->tpl])}
		                					   <option value="[value]">[value]</option>
		                				   {/if}
		                			   {/foreach}
		                			</select>
		                		</div>
		                		<div class="layui-form-mid layui-word-aux">温馨提示：为空（无）即默认模板</div>
		                   	</div>

							<div class="layui-form-item">
			                     <label class="layui-form-label">作者昵称</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="author" placeholder="" value="{$content->author}" class="layui-input">
			                     </div>
			                </div>
							{if([$field_source])}
			                <div class="layui-form-item">
			                     <label class="layui-form-label">来源</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="source" placeholder="" value="{$content->source}" class="layui-input">
			                     </div>
			                </div>
							{/if}

							<div class="layui-form-item">
		                   	    <label class="layui-form-label">浏览量</label>
		                   	    <div class="layui-input-inline">
		                   	        <input type="text" name="visits" placeholder="请输入浏览量" value="{$content->visits}" class="layui-input">
		                   	    </div>
								<div class="layui-form-mid layui-word-aux">温馨提示：支持自定义浏览量</div>   
		                   	</div>

							<div class="layui-form-item">
			                     <label class="layui-form-label">发布时间</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="date" value="{$content->date}" readonly placeholder=""  class="layui-input datetime">
			                     </div>
			                     <div class="layui-form-mid layui-word-aux">温馨提示：设置未来时间可定时发布！</div>
			                </div>
			                
			                <div class="layui-form-item">
			                     <label class="layui-form-label">状态</label>
			                     <div class="layui-input-block">
			                     	<input type="radio" name="status" value="1" title="显示" {if([$content->status]==1)} checked="checked"{/if}>
									<input type="radio" name="status" value="0" title="待审核" {if([$content->status]==0)} checked="checked"{/if}>
			                     </div>
			                </div>
					    </div>
					  </div>
					</div>
					<div class="layui-form-item">
						 <div class="layui-input-block">
						    <button type="button" class="layui-btn" lay-submit lay-filter="*" onclick="subclick()">立即提交</button>
						    {fun=get_btn_back()}
						 </div>
					</div>
	  		</form>
	  	</div>
	  </div>
	</div>
	{/if} 

</div>

<style>.placeHolder {border:dashed 2px gray; }</style>
<script type="text/javascript" src="{APP_THEME_DIR}/js/jscolor.js"></script>

<script type="text/javascript">
$("#pics_box").dragsort({
	dragSelector: "dl",
	dragSelectorExclude: "input,textarea,dd",
	dragBetween: false,
	dragEnd: saveOrder,
	placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
});

function saveOrder() {
	var data = $("#pics_box dl dt img").map(function() {
		return $(this).data("url");
	}).get();
	$("input[name=pics]").val(data.join(","))
};

</script>

<script>
function subclick(){
	$('#edit').submit();
}
</script>

{include file='common/ueditor.html'}
{include file='common/foot.html'}
